<%@ page import="com.luntan.school.service.Posts" %>
<%@ page import="java.util.List" %>
<%@ page import="com.luntan.school.dao.PostsDao" %>
<%@ page import="com.luntan.school.dao.impl.PostsDaoImpl" %>
<%@ page import="com.luntan.school.service.PostsService" %>
<%@ page import="com.luntan.school.service.impl.PostsServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: 舒俊容
  Date: 2023/12/19
  Time: 11:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>帖子详情</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <link rel="stylesheet" href="css/postdetail.css">
    <link rel="stylesheet" href="css/head.css">
    <link rel="stylesheet" href="css/top.css">

<%--    <link rel="stylesheet" href="css/index.css">--%>
</head>
<body>
    <jsp:include page="commons/header.jsp"></jsp:include>
<br>
<br>
<%
    int id = Integer.parseInt(request.getParameter("id"));
    PostsService postsService = new PostsServiceImpl();
    Posts posts = postsService.getPostsById(id);
    request.setAttribute("posts",posts);

%>
<div class="content container">
    <div class="post-info">
        <div class="post-info"><img src="${pageContext.request.contextPath}/img/${sessionScope.user.photo}" alt="用户头像"></div>
        <div class="username">${sessionScope.user.nickname}</div>
        <div class="date">${posts.pubDate}</div>
    </div>
    <div class="post-title">${posts.title}</div>
    <div class="img"><img src="img/${posts.img}"></div>
<%--    <img src="img/<%=posts.getImg()%>" alt="">--%>
    <div class="post-content">
        <p>${posts.content}</p>
    </div>

    <div class="like">

        <i class="fa fa-thumbs-up like-icon"></i>
        <span class="like-count" id="like-count">${posts.likeNum}</span>

        <i class="fa fa-thumbs-down dislike-icon" style="margin-left: 50px; margin-top: 5px;" ></i>
        <span class="unlike-count">${posts.dislikeNum}</span>

    </div>

    <hr>
    <h3 style="margin-top: 20px;">全部评论</h3>
    <div class="comment-list">
        <div class="comment-item">
            <img src="${pageContext.request.contextPath}/img/${sessionScope.user.photo}" alt="用户头像">
            <div class="username">用户名</div>
            <div class="date">2023-01-01</div>
            <div class="content"><p>content</p></div>
        </div>
        <div class="comment-item">
            <img src="img/p1.jpg" alt="用户头像">
            <div class="username">用户名</div>
            <div class="date">2023-01-01</div>
            <div class="content"><p>content</p></div>
        </div>
        <div class="comment-form">
            <textarea placeholder="发表评论"></textarea>
            <button>发表</button>
        </div>
    </div>
</div>
<footer class="footer container">
    <p>© 2023 校园论坛</p>
</footer>
</body>
<script src="js/post.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

</html>